home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_400
/
422_04
/
mc_vs_sc.doc
< prev
next >
Wrap
Text File
|
1994-03-20
|
22KB
|
504 lines
A
Comparison
of
===========================================================
MM MM IIIIIII CCCC RRRRRR OOO CCCC
M M M M I C C R R O O C C
M M M I C R R O O C
M M I C RRRRRR O O ----- C
M M I C R R O O C
M M I C C R R O O C C
M M IIIIIII CCCC R R OOO CCCC
===========================================================
A N D
===========================================================
SSSSS MM MM A L L CCCC
S S M M M M A A L L C C
S M M M A A L L C
SSSSS M M A A L L ----- C
S M M AAAAAAA L L C
S S M M A A L L C C
SSSSS M M A A LLLLLLL LLLLLLL CCCC
===========================================================
Copyright 1990-1994 Dave Dunfield
All rights reserved
MICRO-C .vs. SMALL-C Page: 1
1. INTRODUCTION
The most common reaction of people hearing about DDS MICRO-C for
the first time is something like "Humph... Another version of the old
SMALL-C compiler". This couldn't be further from the truth.
MICRO-C IS NOT SMALL-C!!!
MICRO-C is a completely new implementation of a 'C' compiler
suitable for use on very small systems. It offers several advantages
over SMALL-C:
- It was designed from the ground up to be easily portable to
different processors & computer platforms. Code generators are
available for 8080, 8051, 80x86, 8096, 6809, 68HC11 and 68HC16
cpu's, and an entire section of the manual is devoted to porting
the compiler.
Although SMALL-C claims to be easily portable, much of it's
arcitecture is oriented toward the original 8080 processor. For an
example of how this affects the compiler, compare the code
generated by the 8086 version of SMALL-C to reference stack (auto)
variables to that produced by MICRO-C.
- It is a more complete implementation of the 'C' language, see the
features comparison later in this document.
- It produces faster, more compact code. See the benchmark results
later in this document.
- MICRO-C employs a fully tokenized parser, allowing statement
analysis to be performed on 16 bit "tokens" instead of text
strings as is done in SMALL-C. This results in MUCH faster
compilation.
- Although it is higher in functionality than SMALL-C, the MICRO-C
compiler is much smaller than SMALL-C (Nearly half the size). This
allows it to run on very small computer systems.
2. DETAILED COMPARISON OF COMPILERS
The following pages contain a detailed comparison of the SMALL-C
version 2 compiler, and MICRO-C.
MICRO-C .vs. SMALL-C Page: 2
2.1 'C' Implementation
= Data Types ===========+ SMALL-C V1 + SMALL-C V2 + MICRO-C +
int | Yes | Yes | Yes |
char | Yes | Yes | Yes |
unsigned int | No | No | Yes |
unsigned char | No | No | Yes |
pointers | Yes | Yes | Yes |
pointers to pointers | No | No | Yes |
structs & unions | No | No | Yes |
Single dimension arrays | Yes | Yes | Yes |
Multi dimension arrays | No | No | Yes |
Arrays of pointers | No | No | Yes |
Arrays of structs | No | No | Yes |
Typecast | No | No | Yes |
sizeof | No | No | Yes |
Static globals & locals | No | No | Yes |
= Control Structures ===+ SMALL-C V1 + SMALL-C V2 + MICRO-C +
if/else | Yes | Yes | Yes |
while | Yes | Yes | Yes |
do/while | No | Yes | Yes |
for | No | Yes | Yes |
switch/case | No | Yes | Yes |
goto | No | Yes | Yes |
Conditional Expressions | No | Yes | Yes |
Inline assembler | Yes | Yes | Yes |
= Pre-Processor ========+ SMALL-C V1 + SMALL-C V2 + MICRO-C +
#define (basic) | Yes | Yes | Yes |
#define (Parameterized) | No | No | Yes |
#define (Multi-line) | No | No | Yes |
#undef | No | No | Yes |
#include (single level) | Yes | Yes | Yes |
#include (nested) | No | Yes | Yes |
#ifdef/#ifndef | No | Yes | Yes |
= Misc features ========+ SMALL-C V1 + SMALL-C V2 + MICRO-C +
Optimization | No | Yes | Yes |
Multiple memory models | No | No | Yes |
Make/touch utility | No | No | Yes |
Source linker | No | No | Yes |
68HC08 code generator | No | No | Yes |
6809 code generator | No | No | Yes |
68HC11 code generator | No | No | Yes |
68HC16 code generator | No | No | Yes |
8080 code generator | Yes | Yes | Yes |
8051 code generator | No | No | Yes |
8086 code generator | No | Yes | Yes |
8096 code generator | No | No | Yes |
Complete standard lib | No | Yes | Yes |
Interrupt serial I/O | No | No | Yes |
Windowing library | No | No | Yes |
TSR support | No | No | Yes |
MICRO-C .vs. SMALL-C Page: 3
2.2 Generated code quality
To test the actual performace of code generated by MICRO-C
against code generated by SMALL-C, I used this "Sieve of
Eratosthenes" prime number generator program, taken from the BYTE
benchmarks:
/*
* The classic "Sieve of Eratosthenes" prime number pr